




var _oEntUtlMessages =
{
sCannotUpdateSystemEntityIcons: LOCID_ENTUTL_CANTUPDSYSENTICN,
sCannotDeleteSystemEntity:		LOCID_ENTUTL_CANTDELSYSENT,
sCannotPublishEntity:			LOCID_ENTUTL_CANTPUBLISHENT,
sConfirmEntityDelete:			LOCID_ENTUTL_CONFIRMDEL,
sCreatingEntity:				LOCID_ENTUTL_CREATINGENT,
sUpdatingEntity:				LOCID_ENTUTL_UPDATINGENT,
sDeletingEntity:				LOCID_ENTUTL_DELETINGENT,
sPublishingEntity:				LOCID_ENTUTL_PUBLISHINGENT
};






var _oEntUtlConst =
{

entityId:							"entityId",


sCustomizationCommandObject:		"SystemCustomization",
sDeleteEntityCommand:				"DeleteEntity",
sCreateEntityCommand:				"CreateEntity",
sUpdateEntityCommand:				"UpdateEntity",
sPublishCustomizationsCommand:		"PublishCustomizations",
sPublishAllCustomizationsCommand:	"PublishAllCustomizations",
sCommandParameterName:				"data",
sUpdateEntityIconsUrlFormat:		"updateIcons.aspx?entityId={0}",
iIconsDialogWidth:					650,
iIconsDialogHeight:					468
};











function createEntity(sDataXml, fCallback, oCallbackParams)
{
var oCommand = new RemoteCommand(_oEntUtlConst.sCustomizationCommandObject, _oEntUtlConst.sCreateEntityCommand);
oCommand.SetParameter(_oEntUtlConst.sCommandParameterName, sDataXml);
executeRemoteCommand(oCommand, _oEntUtlMessages.sCreatingEntity, fCallback, oCallbackParams);
}




function updateEntity(sDataXml, fCallback, oCallbackParams)
{
var oCommand = new RemoteCommand(_oEntUtlConst.sCustomizationCommandObject, _oEntUtlConst.sUpdateEntityCommand);
oCommand.SetParameter(_oEntUtlConst.sCommandParameterName, sDataXml);
executeRemoteCommand(oCommand, _oEntUtlMessages.sUpdatingEntity, fCallback, oCallbackParams);
}




function deleteEntity(sEntityId, bCustomEntity, fCallback, oCallbackParams)
{

if (!bCustomEntity)
{
alert(_oEntUtlMessages.sCannotDeleteSystemEntity);
return;
}


if (!confirm(_oEntUtlMessages.sConfirmEntityDelete))
{
return;
}


var oCommand = new RemoteCommand(_oEntUtlConst.sCustomizationCommandObject, _oEntUtlConst.sDeleteEntityCommand);
oCommand.SetParameter(_oEntUtlConst.entityId, sEntityId);
executeRemoteCommand(oCommand, _oEntUtlMessages.sDeletingEntity, fCallback, oCallbackParams);
}




function publishEntities(sDataXml, bPublishableEntity, fCallback, oCallbackParams)
{

if (!bPublishableEntity)
{
alert(_oEntUtlMessages.sCannotPublishEntity);
return;
}

var oCommand = new RemoteCommand(_oEntUtlConst.sCustomizationCommandObject, _oEntUtlConst.sPublishCustomizationsCommand);
oCommand.SetParameter(_oEntUtlConst.sCommandParameterName, sDataXml);
executeRemoteCommand(oCommand, _oEntUtlMessages.sPublishingEntity, fCallback, oCallbackParams);
}

function publishEntitiesAll(fCallback, oCallbackParams)
{
var oCommand = new RemoteCommand(_oEntUtlConst.sCustomizationCommandObject, _oEntUtlConst.sPublishAllCustomizationsCommand);
executeRemoteCommand(oCommand, _oEntUtlMessages.sPublishingEntity, fCallback, oCallbackParams);
}




function updateEntityIcons(sEntityId, bCustomEntity)
{

if (!bCustomEntity)
{
alert(_oEntUtlMessages.sCannotUpdateSystemEntityIcons);
return;
}


var sUrl = formatString(_oEntUtlConst.sUpdateEntityIconsUrlFormat, sEntityId);
openStdDlg(sUrl, null, _oEntUtlConst.iIconsDialogWidth, _oEntUtlConst.iIconsDialogHeight);
}

